//Package book 模型
package book

import (

    "wskyygyso/api/app/models"
    "wskyygyso/api/pkg/database"
)

type Book struct {
    models.BaseModel

    //TODO Put fields in here

    models.CommonTimestampsField
}

func (book *Book) Create() {
    database.DB.Create(&book)
}

func (book *Book) Save() (rowsAffected int64) {
    result := database.DB.Save(&book)
    return result.RowsAffected
}

func (book *Book) Delete() (rowsAffected int64) {
    result := database.DB.Delete(&book)
    return result.RowsAffected
}